package com.tomshushu.doc.freedoc.modular.teamuser.controller;

import com.tomshushu.doc.freedoc.core.model.response.ResponseData;
import com.tomshushu.doc.freedoc.core.model.response.SuccessResponseData;
import com.tomshushu.doc.freedoc.modular.teamuser.model.param.SetDefaultTeamParam;
import com.tomshushu.doc.freedoc.modular.teamuser.model.param.TeamUserParam;
import com.tomshushu.doc.freedoc.modular.teamuser.model.param.TeamUserQueryParam;
import com.tomshushu.doc.freedoc.modular.teamuser.service.TeamUserService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @description:
 * @author: zhouhong
 * @date: 2025-06-11 12:35
 * @version: 1.0
 */
@RestController
@RequestMapping("/doc/teamuser")
public class TeamUserController {

    @Resource
    private TeamUserService teamUserService;
    /**
     * 关联团队-用户
     * @param teamUserParam
     */
    @PostMapping("/addTeamUser")
    public ResponseData addTeamUser(@RequestBody TeamUserParam teamUserParam) {
        teamUserService.addTeamUser(teamUserParam);
        return new SuccessResponseData();
    }
    /**
     * 解除团队-用户关联
     * @param teamUserParam
     */
    @PostMapping("/deleteTeamUser")
    public ResponseData deleteTeamUser(@RequestBody TeamUserParam teamUserParam) {
        teamUserService.deleteTeamUser(teamUserParam);
        return new SuccessResponseData();
    }
    /**
     * 获取团队用户列表
     * @param param
     * @return
     */
    @PostMapping("/pageUserByTeamId")
    public ResponseData pageUserByTeamId(@RequestBody TeamUserQueryParam param) {
        return new SuccessResponseData(teamUserService.pageUserByTeamId(param));
    }
    /**
     * 获取未关联用户列表
     * @param param
     * @return
     */
    @PostMapping("/pageUnUnionUser")
    public ResponseData pageUnUnionUser(@RequestBody TeamUserQueryParam param) {
        return new SuccessResponseData(teamUserService.pageUnUnionUser(param));
    }

    /**
     * 设置默认团队
     * @param param
     */
    @PostMapping("/setDefaultTeam")
    public ResponseData setDefaultTeam(@RequestBody SetDefaultTeamParam param) {
        teamUserService.setDefaultTeam(param);
        return new SuccessResponseData();
    }

}